package example.meeting;
import com.google.protobuf.ByteString;
import grpc.htsoft.helloworld.HelloReply;
import grpc.htsoft.meeting.*;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;

import java.io.IOException;

public class MeetingServer {
    public static void main(String[] args) throws IOException, InterruptedException {
        System.out.println("Hello, MeetingServer!");
        Server server = ServerBuilder.forPort(50099)
                .addService(new MeetingServiceImpl())
                .build();
        System.out.println("Starting server...");
        server.start();
        System.out.println("Server started!");
        server.awaitTermination();

    }
    public static  class MeetingServiceImpl extends MeetingGreeterGrpc.MeetingGreeterImplBase{
        /*
        @Override
        public void postContents(ContentRequest request, StreamObserver<ContentReply> responseObserver) {
//            super.postContents(request, responseObserver);

            String greeting = "Hello sayHello java server, " + request.getId();
            ByteString.copyFrom("zgw".getBytes());
            ContentReply response = ContentReply.newBuilder().setMessage(greeting)
                    .setCode(ByteString.copyFrom("zgw".getBytes()))
                    .build();

            responseObserver.onNext(response);
            responseObserver.onCompleted();
        }

        @Override
        public void getContents(ContentRequest request, StreamObserver<ContentReply> responseObserver) {
            super.getContents(request, responseObserver);
        }

        @Override
        public void getContentsList(ContentRequest request, StreamObserver<ContentReply> responseObserver) {
            super.getContentsList(request, responseObserver);
        }

        @Override
        public void getContentsDetail(ContentRequest request, StreamObserver<ContentReply> responseObserver) {
            super.getContentsDetail(request, responseObserver);
        }

         */
    }

}
